import request from '@/utils/axios/axios-service.ts'

/**
 * 补贴配置
 */
export const subsidyConfigList = (params: any) => request.get('/subsidy/config/list', {params: params})
export const subsidyConfigInfo = (id: number) => request.get('/subsidy/config/info/' + id)
export const subsidyConfigSaveOrUpdate = (params: any, isCreate: boolean) => request.post(isCreate ? '/subsidy/config/create' : '/subsidy/config/update', params)
export const subsidyConfigTypeList = (type: number) => request.get('/subsidy/config/type_list/' + type)

/**
 * 排队补贴记录
 */
export const subsidyQueueList = (params: any) => request.get('/subsidy/queue/list', {params: params})
export const subsidyQueueInfo = (id: number) => request.get('/subsidy/queue/info/' + id);
export const subsidyQueueCancel = (id: number) => request.post('/subsidy/queue/cancel/' + id);
export const subsidyQueueRecover = (id: number) => request.post('/subsidy/queue/recover/' + id);

export const subsidyIncomeList = (params: any) => request.get('/subsidy/income/list', {params: params})

/**
 * 补贴红包接口
 */
export const subsidyPacketList = (params: any) => request.get('/subsidy/packet/list', {params: params})
export const subsidyPacketSend = (params: any) => request.post('/subsidy/packet/send', params)
export const subsidyPacketSwitchEnabled = (id: number) => request.post('/subsidy/packet/switch_enabled/' + id);
export const subsidyPacketCalculateCount = () => request.get('/subsidy/packet/calculate_count');

/** 补贴配置 */
export type SubsidyConfig = {
  id: number;
  type: number;
  mode: number;
  name: string;
  // 共有字段
  subsidy_ratio: number; // 补贴比例
  // 1.0 字段
  rebate_ratio: number; // 让利比例
  promotion_ratio: number; // 推广奖金比例
  service_fee_ratio: number; // 联盟服务费
  // 2.0 字段
  total_ratio: number;
  gold_ratio: number;
  inviter_ratio: number;
  level_ratio1: number;
  level_ratio2: number;
  region_ratio3: number;
  region_ratio2: number;
  region_ratio1: number;
  big_region_ratio: number;
  remark: string;
};
